package com.eeds.service.index.impl;

import com.eeds.dao.CultureDao;
import com.eeds.dao.ProclamationDao;
import com.eeds.model.index.res.ResGetWelcomeInfoVO;
import com.eeds.model.index.res.ResGetWelcomeProclamationInfoVO;
import com.eeds.model.index.vo.CorporateCultureVO;
import com.eeds.model.index.vo.ProclamationInfoVO;
import com.eeds.model.index.vo.TeamCultureVO;
import com.eeds.service.index.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexServiceImpl implements IndexService {

    @Autowired
    private CultureDao cultureDao;

    @Autowired
    private ProclamationDao proclamationDao;


    /**
     * 获取欢迎页数据
     *
     * @return
     */
    @Override
    public ResGetWelcomeInfoVO getWelcomeInfo() {
        ResGetWelcomeInfoVO resGetWelcomeInfoVO = new ResGetWelcomeInfoVO();
        List<ProclamationInfoVO> proclamationInfoList = proclamationDao.getWelcomeProclamationInfoList();
        TeamCultureVO teamCultureVO = new TeamCultureVO(cultureDao.getculture(1));
        CorporateCultureVO corporateCultureVO = new CorporateCultureVO(cultureDao.getculture(2));
        resGetWelcomeInfoVO.setProclamationInfoList(proclamationInfoList);
        resGetWelcomeInfoVO.setTeamCulture(teamCultureVO);
        resGetWelcomeInfoVO.setCorporateCulture(corporateCultureVO);
        return resGetWelcomeInfoVO;
    }

    /**
     * 获取欢迎页公告数据
     *
     * @return
     */
    @Override
    public ResGetWelcomeProclamationInfoVO getWelcomeProclamationInfo() {
        ResGetWelcomeProclamationInfoVO resGetWelcomeProclamationInfoVO  = new ResGetWelcomeProclamationInfoVO();
        resGetWelcomeProclamationInfoVO.setProclamation1(proclamationDao.getProclamationInfoByType(1));
        resGetWelcomeProclamationInfoVO.setProclamation2(proclamationDao.getProclamationInfoByType(2));
        resGetWelcomeProclamationInfoVO.setProclamation3(proclamationDao.getProclamationInfoByType(3));
        resGetWelcomeProclamationInfoVO.setProclamation4(proclamationDao.getProclamationInfoByType(4));
        return resGetWelcomeProclamationInfoVO;
    }
}
